<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ page import="java.util.*,com.csmy.example.contain.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Insert title here</title>
<script type="text/javascript">
	function turnToAddPage(){
		window.location.href="addProduct.jsp";
	}
</script>
</head>
<body>
	<input type="button" value="添加商品" onclick="turnToAddPage()"/>
	<table border="1">
		<tr>
			<td>商品id</td>
			<td>商品名称</td>
			<td>商品价格</td>
			<td>商品数量</td>
			<td>商品类别</td>
			<td>编辑</td>
			<td>删除</td>
		</tr>
		<c:forEach items="${list }" var="p">
			<tr>
				<td width="10%">${p.id }</td>
				<td width="20%">${p.name }</td>
				<td width="15%">${p.price }</td>
				<td width="15%">${p.pnum }</td>
				<td width="25%">${p.category }</td>
				<td width="5%"><a href="EditProductServlet?p_id=${p.id }"><img src="imgs/i_edit.gif"></a></td>
				<td width="5%"><a href="DeleteProductServlet?p_id=${p.id }"><img src="imgs/i_del.gif"></a></td>
			</tr>
		</c:forEach>
		<c:if test="${empty list }">
			<tr>
				<td colspan="7">很抱歉，没有商品了</td>
			</tr>
		</c:if>
	</table>
</body>
</html>